#lang r5rs

(define fac (lambda (f) (lambda (n) (if (> n 1)
                                        (* n (f (- n 1)))
                                        1))))
(define Y (lambda (f) (f (f (f(f(f (f(f(f(f(f f))))))))))))
(define facf (Y fac))
(display (facf 5))